package com.xiaodeng.xdblogspringboot.config;





import com.xiaodeng.xdblogspringboot.exception.ApplicationException;
import com.xiaodeng.xdblogspringboot.interceptors.AdminInterceptor;
import com.xiaodeng.xdblogspringboot.interceptors.GlobalInterceptor;
import com.xiaodeng.xdblogspringboot.interceptors.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class Webconfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    @Autowired
    private GlobalInterceptor globalInterceptor;
    @Autowired
    private AdminInterceptor adminInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //token 刷新拦截器
        registry.addInterceptor(globalInterceptor).addPathPatterns("/**").order(0);
        registry.addInterceptor(loginInterceptor);
        registry.addInterceptor(adminInterceptor);



    }
}
